package com.cjl.service.impl;

import com.cjl.entity.EbComment;
import com.cjl.mapper.CommentMapper;
import com.cjl.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description:用一句话描述
 * @Auther:李春霞
 * @Date:
 */
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;
    @Override
    public List<EbComment> listByPage(Integer page, Integer pageSize)  {
        System.out.println("Service层--->调用了Service的listByPage方法");
        int from=(page-1)*pageSize;
        return commentMapper.findByPage( from, pageSize);
    }
    @Override
    public Integer findTotalPage(Integer pageSize) {

        return commentMapper.getTotalPage(pageSize);
    }
    @Override
    public EbComment selectOne(Integer ecId){
        return commentMapper.selectOne(ecId);
    }
    @Override
    public Integer updateComment (EbComment ebComment) {
        return commentMapper.updateByPrimaryKey(ebComment );
    }

    @Override
    public int deleteByPk(int id) {
        return commentMapper.deleteByPk(id);
    }

}
